<template>
  <view :class="isShopCart ? 'shop-cart' : ''">
    <movable-area class="online-box" style="width:100vw;" :style="{ height: height }">
      <movable-view @change="changePosition" style="z-index:1000;" :x="x" :y="y" friction="10" inertia="false"
        direction="all" :animation="moveAnimation">
        <button @click="trackWacth" open-type="contact" show-message-card="true" size="20" class="kf_button"
          style="background-color:transparent">
          <!-- <view class="desc">顾问</view> -->
        </button>
      </movable-view>
    </movable-area>
  </view>
</template>
<script>
  import {
    CUSTOMER_INFO,
    MERCHANT_INFO,
    USER_INFO
  } from '@/utils/constant';
  export default {
    data() {
      return {
        x: getApp().globalData.onLineServiceX,
        y: getApp().globalData.onLineServiceY,
        height: 0,
      };
    },

    mounted() {
      let systemInfo = uni.getSystemInfoSync()
      this.height = systemInfo.windowHeight - getApp().globalData.navBarHeight + 'px'
      this.x = getApp().globalData.onLineServiceX
      this.y = getApp().globalData.onLineServiceY
    },
    methods: {
      changePosition(e) {
        // getApp().globalData.onLineServiceX = e.detail.x;
        // getApp().globalData.onLineServiceY = e.detail.y;
      },

      trackWacth() {
        this.$commonSensors.simpleTrack('OnlineCustomerService')
        let clTrackPrams = {
          'c_pagename': this.currPageRoute
        }
        getApp().commonClTrack('c_ebmp_click_cs', clTrackPrams)
      }
    }
  };
</script>
<style lang="less">
  .fk-button-box {
    width: 76rpx !important;
    height: 76rpx;
  }

  .kf_button {
    border-radius: 50%;
    overflow: hidden;
    background-image: url(https://100000063-1252208446.file.myqcloud.com/images/concat-B.png);
    background-size: 108rpx 108rpx;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;

    .mcl-xinxi {
      font-size: 40rpx;
      color: #fff;
      line-height: 72rpx;
    }

    .desc {
      line-height: 18rpx;
      color: #fff;
      font-size: 22rpx;
    }
  }

  .flex-box {
    display: flex;
    flex-direction: column;
  }

  .kf_img {
    width: 76rpx;
    height: 76rpx;
  }

  .img-plus-style {
    height: 170rpx;
    width: 170rpx;
    position: fixed;
    bottom: 220rpx;
    right: 30rpx;
    opacity: 1;
  }

  .zindex100 {
    z-index: 100;
  }

  .yc {
    opacity: 1;
    background-color: white;
  }

  .shop-cart .fix-iphonex {
    // margin-top: -120rpx;
  }

  .online-box {
    position: fixed;
    left: 0;
    top: 168rpx;
    z-index: 1000;
    // z-index: -1;
    background-color: transparent;
  }

  movable-area {
    position: relative;
    pointer-events: none;
  }

  movable-view {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    // position: fixed;
    z-index: 9999;
    width: 96rpx !important;
    height: 96rpx !important;
    right: auto;
  }


</style>
